package com.soxing.webrain.brush.controller;

import java.util.Arrays;
import java.util.Map;

import com.soxing.webrain.brush.common.util.PageUtils;
import com.soxing.webrain.brush.dao.service.impl.TesteeExtServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.soxing.webrain.brush.dao.entity.TesteeExt;
import com.soxing.webrain.brush.domain.view.R;

import javax.annotation.Resource;

/**
 * 被试信息
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2024-04-02 10:02:28
 */
@RestController
@RequestMapping("/testeeExt")
public class TesteeExtController {
    @Resource
    private TesteeExtServiceImpl testeeExtService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = testeeExtService.queryPage(params);

        return R.ok().data("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        TesteeExt testee = testeeExtService.getById(id);

        return R.ok().data("testee", testee);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TesteeExt testee){
        testeeExtService.save(testee);

        return R.ok().data("data", testee);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TesteeExt testee){
        testeeExtService.updateById(testee);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        testeeExtService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
